from typing import List

# 难度高不代表回报高 😂
# 超时了

class Solution:
    def maxProfitAssignment(self, difficulty: List[int], profit: List[int], worker: List[int]) -> int:
        works = [(difficulty[i], profit[i]) for i in range(len(difficulty))]
        return sum([self.chooseWork(works, w) for w in worker])

    def chooseWork(self, works, worker):
        r = 0
        for [difficulty, profit] in works:
            if difficulty <= worker and profit > r:
                r = profit
        return r


solu = Solution()
# print(solu.maxProfitAssignment(difficulty=[2,4,6,8,10], profit=[10,20,30,40,50], worker=[4,5,6,7]))
print(solu.maxProfitAssignment(difficulty=[68,35,52,47,86], profit=[67,17,1,81,3], worker=[92,10,85,84,82])) # 324